﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MapAndCharacter_Filip
{
    public partial class ClassTable : Form
    {
        Dictionary<string, string[]> classBaseAttack;
        Dictionary<string, int[]> classSaves;
        Dictionary<string, string[]> classSpecials;
        string[] levelString;

        public ClassTable(Dictionary<string, string[]> classCatalog, Dictionary<string, int[]> classSaves, Dictionary<string, string[]> classSpecials)
        {
            InitializeComponent();
            this.classSaves = classSaves;
            this.classBaseAttack = classCatalog;
            this.classSpecials = classSpecials;
            levelString = new string[20] {"FIRST","SECOND","THIRD", "FOURTH", "FIFTH", "SIXTH", "SEVENTH", "EIGHTH", "NINTH", "TENTH", "ELEVENTH", "TWELEFTH", "THIRTEENTH", "FOURTEENTH", "FIFTEENTH", "SIXTEENTH", "SEVENTEENTH", "EIGHTEENTH","NINETEENTH", "TWENTITH"};
        }

        public void ClassTable_Load(object sender, EventArgs e)
        {

            string baseAttackPrint = "Works";
            string specialPrint = "";

            for (int i = 0; i < 20; i++)
            {
                for (int j = 0; j < classBaseAttack[levelString[i]].Length; j++)
                {
                    if (j == 0)
                        baseAttackPrint = "+" + classBaseAttack[levelString[i]][j];
                    else
                        baseAttackPrint += "/+" + classBaseAttack[levelString[i]][j];
                }

                specialPrint = "";

                if (classSpecials[levelString[i]].Length != 0)
                {
                    for (int k = 0; k < classSpecials[levelString[i]].Length; k++)
                    {
                        if (k == 0)
                            specialPrint = classSpecials[levelString[i]][k];
                        else
                            specialPrint += ", " + classSpecials[levelString[i]][k];
                    }
                }

                string fortSave = "+" + classSaves[levelString[i]][0].ToString();
                string refSave = "+" + classSaves[levelString[i]][1].ToString();
                string willSave = "+" + classSaves[levelString[i]][2].ToString();

                classTableDG.Rows.Add((i + 1).ToString(), baseAttackPrint, fortSave, refSave, willSave, specialPrint);
            }
        }
    }
}
